const key = '801794fb48c62230cdc3026bdb96f75b';

const baseUrl = 'https://restapi.amap.com';

// 获取天气预报
export const getWeather = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/weather/weatherInfo`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};
//静态地图
export const getStaticMap = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/staticmap`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};



//行政区域查询
export const getDistrict = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/config/district`,
        data: {
            ...params,
            key,
            output: 'JSON',
            extensions: params.extensions || 'base'
        },
        method: 'GET'
    })
};

//ip定位
export const getIpLocation = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/ip`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};

//地理编码
export const getGeocode = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/geocode/geo`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};
//逆地理编码
export const getReGeocode = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/geocode/regeo`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};  
//步行路径规划
export const getWalkingRoute = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/direction/walking`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};
//公交路径规划
export const getBusRoute = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/direction/transit/integrated`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};
//驾车路径规划
export const getDrivingRoute = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/direction/driving`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};
//骑行路径规划
export const getBikeRoute = (params) => {
    return uni.request({
        url: `${baseUrl}/v5/direction/bicycling`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};
//距离测量
export const getDistance = (params) => {
    return uni.request({
        url: `${baseUrl}/v3/distance`,
        data: {
            ...params,
            key
        },
        method: 'GET'
    })
};

